import java.util.ArrayList;
import java.util.Vector;

import junit.framework.TestCase;

public class copyoftrialgameTest extends TestCase{

	protected void setUp() throws Exception {
		
		
	}
	/**
	
	public void testUpDown()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		testGame.checkUpDown();
		assertEquals(testGame.vTopToBottom.size(),3);
		assertEquals(testGame.vTopToBottom.get(2).size(),3);
	}
	
	public void testLeftRight()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		testGame.checkLeftRight();;
		assertEquals(testGame.vLeftToRight.size(),3);
		assertEquals(testGame.vLeftToRight.get(0).get(0).Row(),1);
		assertEquals(testGame.getInsideLeftRight(2).size(),1);
	}
	
	public void testDiagonalLeftRight()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		//assert vectors in game match vectors in setUp
		assertEquals(testGame.vDiagonalLeftToRight.size(),4);
		assertEquals(testGame.vDiagonalLeftToRight.get(1).size(),2);
	}
	
	public void testDiagonalRightLeft()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		testGame.checkDiagonalRightLeft();
		//assert vectors in game match vectors in setUp
		assertEquals(testGame.vDiagonalRightToLeft.size(),4);
		assertEquals(testGame.vDiagonalRightToLeft.get(2).size(),2);
	}
	
	public void testFindDouble()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		
		testGame.grabDoubles();
		assertEquals(testGame.vDouble.size(),2);
	}
	
	public void testFindTriple()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		
		testGame.grabTriples();
		assertEquals(testGame.vTriple.size(),2);
	}
	
	public void testCheck1()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		ArrayList<Move> list= new ArrayList<Move>();
		list.add(new Move(1,2));
		list.add(new Move(1,3));
		int result = testGame.checkType(list);
		assertEquals(result,1);
	}
	
	public void testCheck2()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		ArrayList<Move> list= new ArrayList<Move>();
		list.add(new Move(1,2));
		list.add(new Move(2,2));
		int result = testGame.checkType(list);
		assertEquals(result,2);
	}
	
	public void testCheck3()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		ArrayList<Move> list= new ArrayList<Move>();
		list.add(new Move(0,1));
		list.add(new Move(1,2));
		int result = testGame.checkType(list);
		assertEquals(result,4);
	}
	
	public void testCheck4()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		testGame.checkDiagonalLeftRight();
		testGame.checkDiagonalRightLeft();
		testGame.checkUpDown();
		testGame.checkLeftRight();
		ArrayList<Move> list= new ArrayList<Move>();
		list.add(new Move(1,2));
		list.add(new Move(2,1));
		int result = testGame.checkType(list);
		assertEquals(result,3);
	}
	
	public void testFindaMoveStarting()
	{
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		Move theMove = testGame.Update_Game(null);
		int result = theMove.Row();
		int resultCol = theMove.Col();
		assertEquals(result,3);
		assertEquals(resultCol,3);
	}
	
	public void testFindaMoveMidgame()
	{
		System.out.println("Testing move mid game");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		testGame.createtestBoard();
		
		Move theMove = testGame.Update_Game(new Move(0,0));
		assertTrue(theMove.Col()==0 || theMove.Col()==4);
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
	
	public void testFakeGame()
	{
		System.out.println("Testing fake game");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		Move theMove = testGame.Update_Game(new Move(3,3));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
		
		theMove = testGame.Update_Game(new Move(3,4));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
		
		theMove = testGame.Update_Game(new Move(2,3));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
		
		theMove = testGame.Update_Game(new Move(3,5));
		theMove = testGame.Update_Game(new Move(3,2));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
	*/
	
	public void testDiagsRightLeft()
	{
		System.out.println("==== Testing diags right left====");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		Move theMove = testGame.Update_Game(new Move(3,3));
		theMove = testGame.Update_Game(new Move(2,2));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
	
	public void testDiagsLeftRight()
	{
		System.out.println("==== Testing diags left right====");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		Move theMove = testGame.Update_Game(new Move(3,3));
		theMove = testGame.Update_Game(new Move(2,4));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
	
	public void testDiagsRightLeftGoingDown()
	{
		System.out.println("==== Testing diags right left going down====");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		Move theMove = testGame.Update_Game(new Move(29,29));
		theMove = testGame.Update_Game(new Move(28,28));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
	
	public void testDiagsLeftRightGoingDown()
	{
		System.out.println("==== Testing diags left right going down====");
		Game testGame = new Game();
		testGame.Initialize_New_Game("blah", 1);
		Move theMove = testGame.Update_Game(new Move(29,29));
		theMove = testGame.Update_Game(new Move(28,30));
		System.out.println("Move row: " + theMove.Row());
		System.out.println("Move col: " + theMove.Col());
	}
}
